import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';
import { RenderType } from '@pkg/setting';

export const columns: BasicColumn[] = [
  {
    title: '使用时间',
    dataIndex: 'createTime',
    width: 120,
  },
  {
    title: '订单号',
    dataIndex: 'orderNo',
    width: 150,
  },
  {
    title: '订单状态',
    dataIndex: 'orderStatus',
    width: 100,
    dictData: [
      { label: '支付成功待核销', value: 1 },
      { label: '部分已核销', value: 2 },
      { label: '全部已核销', value: 3 },
      { label: '已取消', value: 4 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '会员手机号',
    dataIndex: 'memberPhone',
    width: 90,
  },
  {
    title: '会员姓名',
    dataIndex: 'memberName',
    width: 100,
  },
  {
    title: '会员卡号',
    dataIndex: 'memberNo',
    width: 120,
  },
  {
    title: '使用次数',
    dataIndex: 'useNum',
    width: 70,
  },
  {
    title: '使用人',
    dataIndex: 'useUserNames',
    width: 120,
  },
  {
    title: '使用产品',
    dataIndex: 'productName',
    width: 160,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderNo',
    label: '订单号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'memberNo',
    label: '会员卡号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'memberPhone',
    label: '会员手机号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'memberName',
    label: '会员姓名',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 5 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
];
